Add a configure option to disable cross-tests
authorAlex Crichton <alex@alexcrichton.com>
Mon, 11 Aug 2014 05:04:15 +0000 (22:04 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 11 Aug 2014 05:04:15 +0000 (22:04 -0700)
The tests are enabled by default and must be opted out of.

Closes #346

Makefile.in
configure
tests/test_cargo_cross_compile.rs

index 277c4b220c3f15bb5a024412a81745da66ee0508..b88e3f477f9811f5c6eeca92fb97db2bd50083fa 100644 (file)
@@ -35,6 +35,7 @@ OPT_FLAG=
 endif
 
 export CFG_VERSION
+export CFG_DISABLE_CROSS_TESTS
 
 ifeq ($(OS),Windows_NT)
 X = .exe
index 091c04000d55df00661942b3401a44af8738225a..f9a34c04eb3cb10616e76fe48598e3377b7c3089 100755 (executable)
--- a/configure
+++ b/configure
@@ -293,6 +293,7 @@ opt debug 1 "build with extra debug fun"
 opt optimize 0 "build with optimizations"
 opt nightly 0 "build nightly packages"
 opt verify-install 1 "verify installed binaries work"
+opt cross-tests 1 "run cross-compilation tests"
 valopt prefix "/usr/local" "set installation prefix"
 valopt local-rust-root "" "set prefix for local rust binary"
 
index 6a3bcc49f4720453ed2c5cab5982713650d1dcb4..035bc45e6dcf01eb47fa26cfc31ef913771dbe9e 100644 (file)
@@ -14,6 +14,13 @@ use cargo::util::process;
 fn setup() {
 }
 
+fn disabled() -> bool {
+    match os::getenv("CFG_DISABLE_CROSS_TESTS") {
+        Some(ref s) if s.as_slice() == "1" => true,
+        _ => false,
+    }
+}
+
 fn alternate() -> &'static str {
     match os::consts::SYSNAME {
         "linux" => "i686-unknown-linux-gnu",
@@ -23,6 +30,8 @@ fn alternate() -> &'static str {
 }
 
 test!(simple_cross {
+    if disabled() { return }
+
     let p = project("foo")
         .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
         .file("src/foo.rs", r#"
@@ -43,6 +52,8 @@ test!(simple_cross {
 })
 
 test!(simple_deps {
+    if disabled() { return }
+
     let p = project("foo")
         .file("Cargo.toml", r#"
             [package]
@@ -78,6 +89,8 @@ test!(simple_deps {
 })
 
 test!(plugin_deps {
+    if disabled() { return }
+
     let foo = project("foo")
         .file("Cargo.toml", r#"
             [package]
@@ -154,6 +167,8 @@ test!(plugin_deps {
 })
 
 test!(plugin_to_the_max {
+    if disabled() { return }
+
     let foo = project("foo")
         .file("Cargo.toml", r#"
             [package]
@@ -237,6 +252,8 @@ test!(plugin_to_the_max {
 })
 
 test!(linker_and_ar {
+    if disabled() { return }
+
     let target = alternate();
     let p = project("foo")
         .file(".cargo/config", format!(r#"
@@ -275,6 +292,8 @@ test!(linker_and_ar {
 })
 
 test!(plugin_with_extra_dylib_dep {
+    if disabled() { return }
+
     let foo = project("foo")
         .file("Cargo.toml", r#"
             [package]
@@ -339,6 +358,8 @@ test!(plugin_with_extra_dylib_dep {
 })
 
 test!(cross_tests {
+    if disabled() { return }
+
     let p = project("foo")
         .file("Cargo.toml", r#"
             [project]